package com.ls.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ls.controller.model.PermissionModel;
import com.ls.entity.SysPermission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 * 权限表 Mapper 接口
 * </p>
 *
 * @author TangQuanBin
 * @since 2019-09-13
 */
@Mapper
@Component
public interface SysPermissionMapper extends BaseMapper<SysPermission> {

    /**
     * 根据用角色id查询拥有的权限
     * @param roleId 用户角色id
     * @return List List<SysPermission> 权限集合
     */
    List<SysPermission> findPermissionsByRoleId(Long roleId);

    /**
     * 查询系统所有有效权限
     * @return List
     */
    List<SysPermission> getAllPermissions();

    /**
     * 获取当前角色的权限
     * @param roleId 角色id
     * @return
     */
    List<PermissionModel> getRolePermission(@Param("roleId") Long roleId);

}
